package cn.tanghom.app.oa.service;


import cn.tanghom.app.oa.model.Leave;
import cn.tanghom.support.page.Pager;

import org.flowable.engine.history.HistoricActivityInstance;
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntity;
import org.flowable.engine.runtime.ProcessInstance;

import java.util.List;
import java.util.Map;

/**
 * 请假业务实现
 *
 * @author tanghom<tanghom@qq.com> on 2016/6/30
 */
public interface LeaveService {

    /**
     * 保存请假
     *
     * @param leave
     */
    void save(Leave leave);

    /**
     * 更新保存
     *
     * @param leave
     */
    void update(Leave leave);

    /**
     * 根据iD删除请假
     *
     * @param id
     */
    void delete(Long id);

    /**
     * 根据ID查询请假
     *
     * @param id
     * @return
     */
    Leave findById(Long id);

    /**
     * 按条件查询所有请假
     *
     * @return
     */
    Pager<Leave> findPageByParams(String userId, Integer status, Long index);

    ProcessInstance startWorkflow(Leave entity, Map<String, Object> variables);
    
    /**
     * 获取部门经理的任务
     * @param userid
     * @param firstrow
     * @param rowcount
     * @return
     */
    public List<Leave> getpagedepttask(String userid,int firstrow,int rowcount);
	public int getalldepttask(String userid);
	
	/**
     * 获取HR部门的任务
     * @param userid
     * @param firstrow
     * @param rowcount
     * @return
     */
	public List<Leave> getpagehrtask(String userid,int firstrow,int rowcount);
	public int getallhrtask(String userid);
	
	/**
	 * 销假任务列表
	 * @param userid
	 * @param firstrow
	 * @param rowcount
	 * @return
	 */
	public List<Leave> getpageXJtask(String userid,int firstrow,int rowcount);
	public int getallXJtask(String userid);
	
	public List<Leave> getpageupdateapplytask(String userid,int firstrow,int rowcount);
	public int getallupdateapplytask(String userid);
    
    public void completereportback(String taskid, String realstart_time, String realend_time);
	public void updatecomplete(String taskid, Leave leave,String reappply);
	public List<String> getHighLightedFlows(ProcessDefinitionEntity deployedProcessDefinition,List<HistoricActivityInstance> historicActivityInstances);
}
